import React from 'react';
import {View, Text, TouchableOpacity, StyleSheet,Dimensions, Image} from 'react-native';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import {StylesConstant} from '../../../common/Constant';

const screenWidth = Dimensions.get('window').width;
const screenHeight = Dimensions.get('window').height;

export default class RegulationItem extends React.Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {}

  shouldComponentUpdate(nextProps, nextState) {
    const current = this.props.item || {};
    const next = (nextProps && nextProps.item) || {};
    if (JSON.stringify(current) !== JSON.stringify(next)) {
      return true;
    }
    return false;
  }

  render() {
    const {item, handleCallback} = this.props;
    const {regulationsName,matterName} = item;
    const itemName = regulationsName?regulationsName:matterName;
    return (
      <TouchableOpacity
        style={styles.cell}
        onPress={() => {
          handleCallback && handleCallback();
        }}>
        <View>
          <View style={{padding:5,paddingTop: 10,paddingBottom: 10}}>
              <View style={styles.listRow}>
                  <Image source={require('../../../assets/images/item/icon_case.png')} style={{width: 18,height: 18,marginRight: 5}} />
                  <Text style={styles.listRowValue}>{itemName}</Text>
              </View>
          </View>

        </View>
      </TouchableOpacity>
    );
  }
}

const styles = StyleSheet.create({
    listRowTitle:{
        flexDirection: 'row',borderBottomWidth: 1,borderColor: '#ADADAD',
        padding: 5,paddingTop: 10,paddingBottom: 10,alignItems: 'center'
    },
    listRow:{
        flexDirection: 'row',justifyContent: 'flex-start',alignItems: 'flex-start',marginBottom: 5
    },
    listRowLabel: {
        width: 100,justifyContent: 'flex-start',flexDirection: 'row',alignItems: 'center'
    },
    listRowValue:{
        color: '#696969',width: screenWidth - 50
    },
    iconStatus: {
        width: 80,height: 20,
        marginTop: -10
    },
    cell: {
      backgroundColor: 'white',
      marginBottom: 5,
      marginLeft: 10,
      marginTop: 5,
      marginRight: 10,
      borderRadius: 7,
      flexDirection: 'row',
      alignItems: 'center',
      justifyContent: 'space-between',
      shadowColor: '#e6e6e6',
      shadowOffset: {width: 4, height: 2},
      shadowOpacity: 0.8,
      shadowRadius: 2,
    },

});
